﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Masood.Utilities.EmailTemplates.Manager;
using Masood.Utilities.EmailTemplates.Enum;
using Masood.Utilities.EmailTemplates.Facotry;
using Masood.Utilities.EmailTemplates.Items;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            IItem orderItem = new Item();
            orderItem.FieldAndValues.Add("DELIVERY_DATE", new DateTime(2012, 1, 1).ToString());
            orderItem.FieldAndValues.Add("CUSTOMER", "Unique world");

            AbstractTemplateManager manager = TemplateManagerFactory.Create(EnumTemplateType.Test);
            Email email = manager.ApplyTemplate("order_template", orderItem);

            //just for testing purpose
            Console.WriteLine("Displaying template...");
            EmailTemplate template = manager.GetTemplate("order_template");
            Console.WriteLine("Template.Subject: {0}", template.Subject);
            Console.WriteLine("Template.Body: {0}", template.Body);
            Console.WriteLine("");

            Console.WriteLine("After applying template...");
            Console.WriteLine("Email.Subject: {0}", email.Subject);
            Console.WriteLine("Email.Body: {0}", email.Body);

            Console.ReadKey();
        }
    }
}
